package com.zsc.edu.gateway.modules.iot.tsl.entity;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.zsc.edu.gateway.common.enums.IState;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

/**
 * @author Yao
 * @desciption 物模型服务
 */
@Setter
@Getter
@NoArgsConstructor
@AllArgsConstructor
@TableName("iot_event")
@JsonInclude
public class Event extends BaseParam {

    private Long productId;

    /**
     * 事件类型
     */
    private Type type;

    /**
     * 是否启用服务
     */
    private Boolean enabled = true;

    /**
     * 服务输出的参数
     */
    @TableField(exist = false)
    private List<CompareParam> outputs;


    public enum Type implements IEnum<String>, IState<Type> {
        /**
         * 主动
         */
        ACTIVE("ACTIVE", "主动"),
        /**
         * 被动
         */
        PASSIVE("PASSIVE", "被动");

        private final String value;
        private final String description;

        Type(String value, String description) {
            this.value = value;
            this.description = description;
        }

        @Override
        public String getValue() {
            return value;
        }

        @Override
        public String toString() {
            return this.description;
        }
    }
}
